#!/usr/bin/env perl

use Time::HiRes qw(time);
use warnings;
use strict;

$::F="/etc/cluster/.status/ssh_response";

$::first=time;
$::node=$::ARGV[0];
open(FD,">$::F");
$::p=select(FD);
$|=1;
select($::p);
print FD "$::first\n";
$::r=`ssh $::node -o connecttimeout=20 -o batchmode=yes echo hello 2>/dev/null`;
chomp($::r);
if($::r ne "hello") {
	print FD "BAD\n";
} else {
	$::first=time;
	print FD "$::first\n";
}
close(FD);
exit(0);

